﻿@using CnGalWebSite.Shared.MasaComponent.Shared.Buttons

<CnGalWebSite.Components.Containers.MasaTitleContainer Icon="@IconType.Home.ToIconString()" Title="主要信息" Class="@Class" Collapable>
        <MRow>
            <MCol Cols="12" Md="6" Lg="3">
                <CnGalWebSite.Components.Images.UploadButton @bind-ImagePath="@Model.MainPicture" ShowCropper Class="mb-4"
                                                                                             Type="@(Model.Type is EntryType.Game or EntryType.ProductionGroup?ImageAspectType._16_9:ImageAspectType.None)"
                                                                                             Text="上传主图" />
            </MCol>
            <MCol Cols="12" Md="6" Lg="3">
             <CnGalWebSite.Components.Images.UploadButton @bind-ImagePath="@Model.Thumbnail" Type="ImageAspectType._1_1" ShowCropper Class="mb-4"
                                                                                         Text="@(Model.Type== EntryType.Staff?"上传头像":"上传缩略图")" />
         </MCol>
            <MCol Cols="12" Md="6" Lg="3">
                 <CnGalWebSite.Components.Images.UploadButton @bind-ImagePath="@Model.BackgroundPicture" Type="ImageAspectType.None" Text="上传大背景"  Class="mb-4"/>
             </MCol>

         <MCol Cols="12" Md="6" Lg="3">
             <CnGalWebSite.Components.Images.UploadButton @bind-ImagePath="@Model.SmallBackgroundPicture" Type="ImageAspectType.None" Text="上传小背景" Class="mb-4" />
         </MCol>
         <MCol Cols="12">
             </MCol>
             <MCol Cols="12" Md="6">
                 <CnGalWebSite.Components.Inputs.MasaSelecte Value="Model.Type" ValueChanged="OnTypeChanged" TValue="EntryType" Label="类型" />
             </MCol>

        <CnGalWebSite.Shared.MasaComponent.Shared.Editors.Cards.DisplayNameCard @bind-Name="Model.Name" @bind-DisplayName="Model.DisplayName" ExistingItems="ExistingItems" Class="form-group col-12 col-sm-6" />

             <MCol Cols="12" Md="6">
                 <MTextField @bind-Value="Model.AnotherName" Label="别称" />
             </MCol>
             <MCol Cols="12" Md="6">
                 <CnGalWebSite.Components.Inputs.MasaSelecte @bind-Value="Model.Template" TValue="EntryStyleTemplate" Label="样式模板" />
             </MCol>

             <MCol Cols="12">
                 <MTextarea Rows="3" @bind-Value="Model.BriefIntroduction" Label="简介" />
             </MCol>

         </MRow>

</CnGalWebSite.Components.Containers.MasaTitleContainer>

@code {
    [Parameter]
    public EditMainViewModel Model { get; set; }
    [Parameter]
    public string Class { get; set; }
    [Parameter]
    public EventCallback<EntryType> TypeChanged { get; set; }
    [Parameter]
    public List<string> ExistingItems { get; set; }

    public async Task OnTypeChanged(EntryType type)
    {
        Model.Type = type;
        await TypeChanged.InvokeAsync(type);
    }

}
